 
package br.ufu.lsi.social.storage.model;

import java.util.Set;

import org.neo4j.graphdb.Direction;
import org.springframework.data.neo4j.annotation.Fetch;
import org.springframework.data.neo4j.annotation.GraphId;
import org.springframework.data.neo4j.annotation.Indexed;
import org.springframework.data.neo4j.annotation.NodeEntity;
import org.springframework.data.neo4j.annotation.RelatedToVia;

@NodeEntity
public class User {

    @GraphId
    private Long nodeId;
    
    @Indexed( unique = true )
    private long id;
    
    private String screenName;
    
    /*@RelatedTo(elementClass = User.class, type = "FOLLOW")
    private Set<User> friends;
    
    @RelatedTo(elementClass = User.class, type = "FOLLOW", direction = Direction.INCOMING)
    private Set<User> followers;*/
    
    @RelatedToVia(elementClass = Follow.class, type = "FOLLOW", direction = Direction.INCOMING)
    @Fetch
    private Set<Follow> followers;
    
    @RelatedToVia(elementClass = Follow.class, type = "FOLLOW")
    @Fetch
    private Set<Follow> friends;

    
    public Long getNodeId() {
        return nodeId;
    }

    public void setNodeId( Long nodeId ) {
        this.nodeId = nodeId;
    }

    public long getId() {
        return id;
    }

    public void setId( long id ) {
        this.id = id;
    }

    public String getScreenName() {
        return screenName;
    }

    public void setScreenName( String screenName ) {
        this.screenName = screenName;
    }

    public Set< Follow > getFollowers() {
        return followers;
    }

    public void setFollowers( Set< Follow > followers ) {
        this.followers = followers;
    }

    public Set< Follow > getFriends() {
        return friends;
    }

    public void setFriends( Set< Follow > friends ) {
        this.friends = friends;
    }


    

}
